package com.yx.controller;


import com.yx.entity.OrderItem;
import com.yx.service.IOrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yx
 * @since 2022-02-07
 */
@RestController
@RequestMapping("/orderItem")
public class OrderItemController {
    @Autowired
    private IOrderItemService ois;
    @GetMapping("/selectAll")
    public List<OrderItem> selectAll(){
        return ois.list();
    }
    @PostMapping("/add")
    public void add(@RequestBody OrderItem orderItem){
        ois.save(orderItem);
    }
    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable("id") int id){
        ois.removeById(id);
    }
}

